<script type="text/javascript">
<!--
$(document).ready(function(){
							$('.tuan').hide();
							});
//-->
</script>
<h3 style="margin-top: 0px;">Xin vui lòng kiểm tra thời gian bạn muốn lập kế hoạch đã tồn tại hay chưa</h3>
<table cellpadding="0" cellspacing="0" id="tables">
<tr>
	<th><?php echo 'STT';?></th>
	<th><?php echo 'Thời gian';?></th>
	<th><?php echo 'Hành động';?></th>
    <th><?php echo 'Trạng thái';?></th>

</tr>
<?php
$i = 0;$sttthang = 0;
foreach ($z1chithikhthangs as $z1chithikhthang):
		$thanght = date('m',strtotime($z1chithikhthang['Z1chithikh']['ngaybd']));
		$class = null;
		$id=null;
		$align =null;
		/*
		if ($sttthang>0)
			echo $form->input('', array('type'=>'hidden','value'=>$stttuan,'id'=>'sotuan'.$sttthang));
		*/	
		$sttthang++;
?>
	<tr<?php echo $class;?>>
		<td>
			<?php echo $sttthang;//$z1chithikh['Z1chithikh']['id']; ?>
		</td>
		<td>
			<?php 
                	echo $html->image('/img/plus.png', array('class'=>'plus','id'=>0,'id'=>$sttthang));
                    echo '<strong>'.date('d/m/Y',strtotime($z1chithikhthang['Z1chithikh']['ngaybd'])).
                        ' - '.date('d/m/Y',strtotime($z1chithikhthang['Z1chithikh']['ngaykt'])).'</strong>';                  
            ?>
		</td>
		<td class="actions">
        <?php
        	echo $this->Html->link(__('Kế hoạch tháng', true), array('controller'=>'nvchithis','action' => 'index', $z1chithikhthang['Z1chithikh']['id']));
      
        ?>
        
		</td>
        <td align='center'>
          <?php 
            if(empty($z1chithikhthang['Z1chithikh']['chithi']))
                $tb='Chưa có';
            else
                $tb='Đã tạo';
            echo $tb;
        ?>
        </td>
	</tr>
	
	
	<?php
		$stttuan=0;
		foreach ($z1chithikhtuans as $z1chithikhtuan):
		 	$thangoftuan = date('m',strtotime($z1chithikhtuan['Z1chithikh']['ngaybd']));
		 	$class = null;
			$id=null;
			$align =null;
		 if($thanght==$thangoftuan)
		 {
		 	$stttuan++;
		 	$class = ' class = tuan ';
			$id = ' id =tuan'.$sttthang.$stttuan;
			$align = ' align=right';
	?>
	<tr<?php echo $class.$id;?>>
		<td>
			<?php //echo $i//$z1chithikh['Z1chithikh']['id']; ?>
		</td>
		<td align='right'>
			<?php 
                    echo date('d/m/Y',strtotime($z1chithikhtuan['Z1chithikh']['ngaybd'])).
                        ' - '.date('d/m/Y',strtotime($z1chithikhtuan['Z1chithikh']['ngaykt']));
                  
            ?>
		</td>
		<td class="actions">
        <?php                                 
            echo $this->Html->link(__('Kế hoạch tuần', true), array('controller'=>'nvngays','action' => 'sua', $z1chithikhtuan['Z1chithikh']['id']));
        ?>
        
		</td>
        <td>
          <?php
            if(empty($z1chithikhtuan['Z1chithikh']['kh']))
                $tb='Chưa tạo';
            else if($z1chithikhtuan['Z1chithikh']['dagiao']==1)
                $tb='Đã giao';
            else if($z1chithikhtuan['Z1chithikh']['dagiao']==2)
                $tb='Đã duyệt';
            else
                $tb='Chưa giao';
                
        echo $tb;                      
           		       
        ?>
        </td>
	</tr>
	<?php
		 }
		endforeach; 
		if ($sttthang>0)
			echo $form->input('', array('type'=>'hidden','value'=>$stttuan,'id'=>'sotuan'.$sttthang));
endforeach; ?>
</table>